import axios from 'axios'

// 评论
export function review (reviewInfo) {
    return axios.post(`post/reply/${reviewInfo.postId}`, { content: reviewInfo.content })
}

// 删除评论
export function deleteReply (replyId) {
    return axios.delete(`post/reply/${replyId}`)
}

// 根据评论Id获取评论
export function getById (replyId) {
    return axios.get(`post/reply/one/${replyId}`)
}

// 分页获取当前用户的评论
export function pageCurrentReplies (pageInfo) {
    return axios.get(`post/reply/${pageInfo.page}/${pageInfo.size}`)
}

// 分页获取帖子的评论
export function pageReply (queryInfo) {
    return axios.get(`post/reply/${queryInfo.postId}/${queryInfo.page}/${queryInfo.size}`, {
        params: {
            type: queryInfo.type,
            asc: queryInfo.asc,
            desc: queryInfo.desc
        }
    })
}

// 投票
export function vote (voteInfo) {
    return axios.post(`post/vote/${voteInfo.id}/${voteInfo.type}`)
}

// 取消投票
export function removeVote (id) {
    return axios.delete(`post/vote/${id}`)
}

// 获取当前用户的所有的投票
export function currentVotes () {
    return axios.get(`post/vote`)
}
